package cn.iocoder.yudao.module.biz.dal.mysql.licenceAudit;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.biz.controller.admin.licenceAudit.vo.BizLicenceAuditExportReqVO;
import cn.iocoder.yudao.module.biz.controller.admin.licenceAudit.vo.BizLicenceAuditPageReqVO;
import cn.iocoder.yudao.module.biz.dal.dataobject.licenceAudit.BizLicenceAuditDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 审核人员 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BizLicenceAuditMapper extends BaseMapperX<BizLicenceAuditDO> {

    default PageResult<BizLicenceAuditDO> selectPage(BizLicenceAuditPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BizLicenceAuditDO>()
                .eqIfPresent(BizLicenceAuditDO::getNumber, reqVO.getNumber())
                .eqIfPresent(BizLicenceAuditDO::getAuditUserId, reqVO.getAuditUserId())
                .eqIfPresent(BizLicenceAuditDO::getLicenceId, reqVO.getLicenceId())
                .eqIfPresent(BizLicenceAuditDO::getStatus, reqVO.getStatus())
                .eqIfPresent(BizLicenceAuditDO::getLastUser, reqVO.getLastUser())
                .betweenIfPresent(BizLicenceAuditDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(BizLicenceAuditDO::getId));
    }

    default List<BizLicenceAuditDO> selectList(BizLicenceAuditExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BizLicenceAuditDO>()
                .eqIfPresent(BizLicenceAuditDO::getNumber, reqVO.getNumber())
                .eqIfPresent(BizLicenceAuditDO::getAuditUserId, reqVO.getAuditUserId())
                .eqIfPresent(BizLicenceAuditDO::getLicenceId, reqVO.getLicenceId())
                .eqIfPresent(BizLicenceAuditDO::getStatus, reqVO.getStatus())
                .eqIfPresent(BizLicenceAuditDO::getLastUser, reqVO.getLastUser())
                .betweenIfPresent(BizLicenceAuditDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByAsc(BizLicenceAuditDO::getNumber));
    }

}
